<?php

namespace App\Http\Controllers;
use Dingo\Api\Routing\Helpers;
class BaseController extends Controller
{
    //
    use Helpers;
    public function returnArray($result = '', $code = 200, $message = 'success')
    {
        $res = [
            'message' => $message,
            'status_code' => $code,
            'data' => $result
        ];
        return $this->response->array($res)->setStatusCode($code);
    }
    //格式化返回..

    protected function respondWithToken($token)
    {
        return response()->json([
            'status_code'=>200,
            'message' =>'OK',
            'data'=>  [ //$this->>response->array()'access_token' => $token,'token_type' => 'Bearer','expires_in' => auth('api')->factory()->getTTL() * 60])
                'access_token' => $token,
                'token_type' => 'Bearer',
                'expires_in' => auth('api')->factory()->getTTL() * 60
            ]]);
    }
}
